package org.example.demo_ottery.common.exception;


import lombok.Data;
import lombok.EqualsAndHashCode;

import org.example.demo_ottery.common.errorcode.ErrorCode;

@Data
@EqualsAndHashCode(callSuper = true)  //继承父类的equals和hashcode方法
public class ControllerException extends RuntimeException {
    /**
     * 异常码
     * @see org.example.demo_ottery.common.errorcode.ControllerErrorCodeConstants
     */
    private Integer code;

    /**
     * 异常信息
     * @see org.example.demo_ottery.common.errorcode.ControllerErrorCodeConstants
     */
    private String massage;

    public ControllerException() {

    }

    public ControllerException(Integer code,String massage) {
        this.code = code;
        this.massage = massage;
    }

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.massage = errorCode.getMassage();
    }
}
